const bodyParser = require('body-parser')

module.exports = app => {
    app.use(bodyParser.json())

    app.post('/api/signin', (req, res) => {
        const { username, password } = req.body;

        if(username === 'admin' && password === 'admin') {
            res.send({
                code: 200,
                data: {
                    token: `weirlajfklnkmdA;WL/K.DMaoi;flikqMWA[ODP'O;QLkawmfopw;lkeM`
                }
            })
        } else {
            res.status(401).send({
                message: '账户错误'
            })
        }
    })
}